package com.junwell.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.junwell.common.dto.PageDto;
import com.junwell.common.lang.PageResult;
import com.junwell.entity.Manager;
import com.junwell.entity.User;
import com.junwell.mapper.UserMapper;
import com.junwell.service.UserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 */
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {

    /*@Autowired
    private UserMapper userMapper;

    @Transactional
    @Override
    public PageResult findPage(PageDto pageDto) {
        Page<User> page = new Page<>(pageDto.getCurrentPage(), pageDto.getPageSize());
        QueryWrapper<User> queryWrapper = new QueryWrapper<>();
        String query = pageDto.getQueryString();
        if (StringUtils.hasLength(query)){
            queryWrapper.or().eq("login_name",pageDto.getQueryString());
            queryWrapper.or().like("login_name",pageDto.getQueryString());
        }
        List<User> managers = userMapper.selectList(queryWrapper);
        return new PageResult(page.getTotal(), managers);
    }*/
}
